package net.peelmeagrape.hibernate.collections;

import net.peelmeagrape.hibernate.xmlgen.ChildElement;
import net.peelmeagrape.hibernate.xmlgen.XmlAttribute;
import net.peelmeagrape.hibernate.xmlgen.XmlElement;
import net.peelmeagrape.hibernate.Column;

import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Map keyed on <i>Any</i> object (classname and id columns).
 */
@Retention(RUNTIME)
@XmlElement(name="index-many-to-any")
public @interface MapKeyManyToAny
{
    @XmlAttribute("id-type") String idType();
    @XmlAttribute("meta-type") String metaType() default "Hibernate.CLASS";

    @ChildElement(0) Column classnameColumn();
    @ChildElement(1) Column[] columnMapping() default {};

}
